package com.liruo.treasureattic.service.user.controller.impl;

import com.liruo.treasureattic.common.httpmsg.result.BaseResponse;
import com.liruo.treasureattic.common.model.vo.user.UserVo;
import com.liruo.treasureattic.common.util.ValidatorUtil;
import com.liruo.treasureattic.service.user.controller.FollowController;
import com.liruo.treasureattic.service.user.service.FollowService;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author:liruo
 * @Date:2023-02-15-11:03:55
 * @Desc
 */
@RestController
public class FollowControllerImpl implements FollowController {
    @Resource
    private FollowService followService;


    @Override
    public BaseResponse<Boolean> follow(Long followId){
        ValidatorUtil.requireGreat0(followId);
        return BaseResponse.success(followService.follow(followId));
    }

    @Override
    public BaseResponse<Boolean> unfollow(Long followId){
        ValidatorUtil.requireGreat0(followId);
        return BaseResponse.success(followService.unfollow(followId));
    }



    @Override
    public BaseResponse<List<UserVo>> getFollowings(){
        return BaseResponse.success(followService.getFollowings());
    }
    @Override
    public BaseResponse<List<UserVo>> getFollowers(){
        return BaseResponse.success(followService.getFollowers());
    }
}
